{% extends "base.html" %}
{% load duoshuo_tags %}

{% block title %}{{ post.title }} | {% endblock %}
{% block desc %}{{ post.summary|truncatewords:140 }}{%  endblock %}
{% block keywords %}{{ post.tags }}{% endblock %}

{% block extend_style %} 
{% if post.is_md %}
<link href="/static/blog/css/codehilite.css" rel="stylesheet" type="text/css" media="screen" />
{% else %}
<link href="/static/blog/css/code.css" rel="stylesheet" type="text/css" media="screen" />
{% endif %}
{% endblock %}

{% block main %}
<div class="detail">
    <h2 class="under_line">
        {% autoescape off %}
        <span>{{ post.title }}</span>
        {% endautoescape %}
    </h2>

    {% if post %}

    <div class="info">
        作者：{{ post.author }} 
        | 分类：<a href="/category/{{ post.category.alias }}" title="查看 post.category.name 中的全部文章" rel="category tag">{{ post.category.name }}</a> 
        | 标签： 
        {% for tag in post.tags_list %}
        <a href="/tag/{{ tag }}" rel="tag">{{ tag }}</a>&nbsp;
        {% endfor %}
        | 阅读 {{ post.view_times }}  次
        | 发布：{{ post.pub_time|date:"Y-m-d P" }}
        {% if user.is_authenticated %}
            <a href="{% url 'xadmin:blog_post_change' post.id %}" target="_blank">edit</a>
        {% endif %}
    </div>

    {% include 'includes/share.html' %}
    
    <div class="clear"></div>

    <div class="content">
        {% autoescape off %}
        {{ post.content_html }}
        {% endautoescape %}
    </div>

    {% include 'includes/share.html' %}

    <div class="clear box"></div>

    <div class="box">
        <div class="row">
            <div class="span4">
                <b>相关文章</b>
                <ul>
                    {% for item in related_posts %}
                    <li><a href="/{{ item.alias }}.html">{{ item.title }}</a></li>
                    {% endfor %}
                </ul>
            </div>
            <div class="span4">
                <b>别人正在读</b>
                <ul>
                    {% for ip, post in lru_views %}
                        {% if ip != cur_user_ip %}
                        <li><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></li>
                        {% endif %}
                    {% endfor %}
                </ul>
            </div>
        </div>
    </div>

    <div class="box">
        【上一篇】
        {% if post.prev_post %}
            <a href="{{ post.prev_post.get_absolute_url }}">{{ post.prev_post.title }}</a>
        {% else %}
            没有了
        {% endif %}
        <br/>
        【下一篇】
        {% if post.next_post %}
            <a href="{{ post.next_post.get_absolute_url }}">{{ post.next_post.title }}</a>
        {% else %}
            没有了
        {% endif %}
    </div>
    {% endif %}

    <span id="comments" name="comments"></span>

    {% duoshuo_comments %}

    {% include "pingback.html" %}
</div>
{% endblock %}

{%  block extend_js %}
<script src="/static/blog/js/jquery-1.8.1.min.js"></script>
<script src="/static/bootstrap/js/bootstrap-dropdown.js"></script>
<script>
$('.dropdown-toggle').dropdown()
</script>
{% endblock %}

